package controller

import (
	"github.com/kataras/iris/mvc"
	"cn.pinming/gencode/core"
	"cn.pinming/gencode/core/controller"
	"cn.pinming/gencode/core/api"
)

type IndexController struct {
	controller.BaseController
}

// Get serves
// Method:   GET
// Resource: http://localhost:8080
func (this *IndexController) Get() mvc.Result {
	this.Data["test"]=true
	return this.ViewResult("index")
}

func (this *IndexController) GetIndex() mvc.Result {
	return mvc.Response{
		Path:"/",
	}
}


// 路由解析，默认使用大写字母分割
// GetNavCollapse handles GET: http://localhost:8080/navcollapse.
func (this *IndexController) GetNavcollapse() api.Result {
	flag,_:= this.Session.GetBoolean(core.NavCollapseKey)
	this.Session.Set(core.NavCollapseKey,!flag)
	return this.Success()
}